home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
SNDLIST-
/
ABOUT.C
next >
Wrap
Text File
|
1988-11-10
|
2KB
|
87 lines
/*
Sound lister
"About.c"
*/
#include <DialogMgr.h>
#include <EventMgr.h>
#include <FontMgr.h>
#include <ResourceMgr.h>
#include "SndList.h"
extern short DlgFont: 0xAFA;
/* ----- Get long version message from 'vers' resource ----------------- */
static void GetVersion(id, message)
register short id;
register unsigned char *message;
{
register Handle h;
register unsigned char *p;
if (h = Get1Resource('vers', id)) {
p = (unsigned char *)(*h);
p += 7 + p[6];
BlockMove(p, message, (long)(p[0] + 1));
ReleaseResource(h);
} else
message[0] = 0;
}
/* ----- Draw user item in dialog box ---------------------------------- */
static pascal void DrawUser(dialog, item) /* Called by Dialog Manager */
register DialogPtr dialog;
register short item;
{
register Handle h;
short type;
Handle itemHdl;
Rect box;
GetDItem(dialog, item, &type, &itemHdl, &box);
if (h = GetResource('ICN#', APPL)) {
HLock(h);
PlotIcon(&box, h);
HUnlock(h);
}
}
/* ----- About ... ----------------------------------------------------- */
void About()
{
register DialogPtr dialog;
register long heap;
long grow;
short item;
short font;
unsigned char s[256];
Handle itemHdl;
Rect box;
short type;
heap = MaxMem(&grow);
font = DlgFont; /* Save current dialog font */
DlgFont = geneva;
CenterDialog('DLOG', AboutDialog, &Bounds);
if (dialog = GetNewDialog(AboutDialog, 0L, -1L)) {
GetVersion(2, s);
SetEText(dialog, AboutText, s);
GetVersion(1, s);
SetEText(dialog, AboutVers, s);
NumToString(heap, s);
SetEText(dialog, AboutHeap, s);
GetDItem(dialog, AboutIcon, &type, &itemHdl, &box);
SetDItem(dialog, AboutIcon, type, &DrawUser, &box);
ShowWindow(dialog);
Play(AboutSnd);
do
ModalDialog(0L, &item);
while (item != AboutOk);
DisposDialog(dialog);
}
DlgFont = font; /* Restore dialog font */
}